package com.ruoyi.electronicFence.controller;

import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.electronicFence.domain.TDeviceInfoModificationHistory;
import com.ruoyi.electronicFence.service.ITDeviceInfoModificationHistoryService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 设备详情修改历史Controller
 *
 * @author ljw
 * @date 2024-11-05
 */
@RestController
@RequestMapping("/electronicFence/deviceModificationHistory")
public class TDeviceInfoModificationHistoryController extends BaseController
{
    @Autowired
    private ITDeviceInfoModificationHistoryService tDeviceInfoModificationHistoryService;

    /**
     * 查询设备详情修改历史列表
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:deviceModificationHistory:list')")
    @GetMapping("/list")
    public TableDataInfo list(TDeviceInfoModificationHistory tDeviceInfoModificationHistory, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")LocalDateTime startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")LocalDateTime endTime)
    {
        startPage();
        List<TDeviceInfoModificationHistory> list = tDeviceInfoModificationHistoryService.selectTDeviceInfoModificationHistoryList(tDeviceInfoModificationHistory, startTime, endTime);
        return getDataTable(list);
    }


    /**
     * 获取设备详情修改历史详细信息
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:deviceModificationHistory:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(tDeviceInfoModificationHistoryService.selectTDeviceInfoModificationHistoryById(id));
    }

    /**
     * 新增设备详情修改历史
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:deviceModificationHistory:add')")
    //@Log(title = "设备详情修改历史", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDeviceInfoModificationHistory tDeviceInfoModificationHistory)
    {
        return toAjax(tDeviceInfoModificationHistoryService.insertTDeviceInfoModificationHistory(tDeviceInfoModificationHistory));
    }

    /**
     * 修改设备详情修改历史
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:deviceModificationHistory:edit')")
    //@Log(title = "设备详情修改历史", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TDeviceInfoModificationHistory tDeviceInfoModificationHistory)
    {
        return toAjax(tDeviceInfoModificationHistoryService.updateTDeviceInfoModificationHistory(tDeviceInfoModificationHistory));
    }

    /**
     * 删除设备详情修改历史
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:deviceModificationHistory:remove')")
    //@Log(title = "设备详情修改历史", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(tDeviceInfoModificationHistoryService.deleteTDeviceInfoModificationHistoryByIds(ids));
    }
}
